


opendir $dir, $ARGV[0] or die "can not open the directory $ARGV[0]!\n";


$fileNum = 0;

#get the minimum start time of 16 channels.
while ($file = readdir $dir) {
	$file_path = "$ARGV[0]\\$file";
	print ("$file_path  \n $file\n");
	
	$logfile = "\.log";
	#get input samples
	if($file =~ /$logfile/) {
	open fin, "<$file_path" or die "can not open file $file_path!\n";
	$fileNum++;
	while (<fin>) {
		chomp;
		@info = split;
			
		if($firstline==1) {
			$firstline = 0;
			next;
		}
		$samples[$sampleNum++] = $info[1];
	}
	close fin;
	}
	else {
		print("No log files found!\n");
		next;
	}
	
}


$cmd = "coffee";
$file = $ARGV[0];
print ("$file\n");
if($file =~ /$bluetooth/) {
	$cmd = "copy /Y ..\\controlLog\\BT\\synchronized\\total.feature ..\\controlLog\\totalFeature\\BTsynchronized.feature";
}
if($file =~ /$zigbee/) {
	$cmd = "copy /Y ..\\controlLog\\ZigBee\\total.feature ..\\controlLog\\totalFeature\\ZigBee.feature";
}
if($file =~ /$microwave/) {
	$cmd = "copy /Y ..\\controlLog\\MO\\total.feature ..\\controlLog\\totalFeature\\MO.feature";
}
if($file =~ /$wifi/) {
	$cmd = "copy /Y ..\\controlLog\\WiFi_11n\\total.feature ..\\controlLog\\totalFeature\\WiFi_11n.feature";
}

print("$cmd\n");
system("$cmd\n");
